<%@page import="phylacterium.entities.TrackEntity"%>
<%@page import="phylacterium.entities.PoiEntity"%>
<jsp:useBean id="bean" class="phylacterium.beans.StatisticsBean" scope="request" />
<%@ include file="header.jspf" %>
<% if (bean.ownPois != null) { %>
<h1>My statistics</h1>
<table border="1">
<tr>
	<th style="color:white; background:gray;">POI</th><th style="color:white; background:gray;">Track</th><th style="color:white; background:gray;">Play Count</th>
</tr>
<% for (PoiEntity poi : bean.ownPois) { %>
	<tr>
		<td valign="top" <% if (poi.tracks.size() > 1) { %>rowspan="<%= poi.tracks.size() %>" <% } %> style="background: #f0b010"><center><b>&nbsp<%= poi.poiName %>&nbsp</b></center></td>
		<% if (poi.tracks.size() == 0) {%>
			<td><center>No tracks</center></td><td></td>
		<% } else {
			boolean first = true;
			for (TrackEntity track : poi.tracks) {
				if (!first) {%>
					</tr><tr>
				<% } first = false; %>	
				<td>&nbsp<%= track.artist.toUpperCase() + " - " %><i><%= track.title %>&nbsp</i></td><td><center><%= track.count %></center></td>
		<% } 
		 } %>
	</tr>
<% } %>

</table>
</br>
</br>
</br>
<% } %>

<h1>Global statistics</h1>
<table border="1">
<tr>
	<th style="color:white; background:gray;">POI</th><th style="color:white; background:gray;">Track</th><th style="color:white; background:gray;">Play Count</th>
</tr>
<% for (PoiEntity poi : bean.globalPois) { %>
	<tr>
		<td valign="top" <% if (poi.tracks.size() > 1) { %>rowspan="<%= poi.tracks.size() %>" <% } %> style="background: #f0b010"><center><b>&nbsp<%= poi.poiName %>&nbsp</b></center></td>
		<% if (poi.tracks.size() == 0) {%>
			<td><center>No tracks</center></td><td></td>
		<% } else {
			boolean first = true;
			for (TrackEntity track : poi.tracks) {
				if (!first) {%>
					</tr><tr>
				<% } first = false; %>	
				<td>&nbsp<%= track.artist.toUpperCase() + " - " %><i><%= track.title %>&nbsp</i></td><td><center><%= track.count %></center></td>
		<% } 
		 } %>
	</tr>
<% } %>

</table>
<%@ include file="footer.jspf" %>